<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="../../">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>SystemDSContext &mdash; SystemDS 3.2.0-dev documentation</title>
      <link rel="stylesheet" type="text/css" href="../../static/pygments.css?v=80d5e7a1" />
      <link rel="stylesheet" type="text/css" href="../../static/css/theme.css?v=19f00094" />

  
  <!--[if lt IE 9]>
    <script src="../../static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="../../static/jquery.js?v=5d32c60e"></script>
        <script src="../../static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
        <script src="../../static/documentation_options.js?v=596fb6d1"></script>
        <script src="../../static/doctools.js?v=888ff710"></script>
        <script src="../../static/sphinx_highlight.js?v=dc90522c"></script>
    <script src="../../static/js/theme.js"></script>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="Algorithms" href="../operator/algorithms.html" />
    <link rel="prev" title="Python end-to-end tutorial" href="../../guide/python_end_to_end_tut.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="../../index.html" class="icon icon-home">
            SystemDS
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption" role="heading"><span class="caption-text">Getting Started:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../getting_started/install.html">Install SystemDS</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../getting_started/simple_examples.html">QuickStart</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Guides</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../guide/federated.html">Federated Environment</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../guide/algorithms_basics.html">Built-in Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../guide/python_end_to_end_tut.html">Python end-to-end tutorial</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">API</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">SystemDSContext</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#systemds.context.SystemDSContext"><code class="docutils literal notranslate"><span class="pre">SystemDSContext</span></code></a><ul>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.__init__"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.__init__()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.array"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.array()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.capture_stats"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.capture_stats()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.capture_stats_context"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.capture_stats_context()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.clear_stats"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.clear_stats()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.close"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.close()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.combine"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.combine()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.dict"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.dict()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.exception_and_close"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.exception_and_close()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.federated"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.federated()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.from_numpy"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.from_numpy()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.from_pandas"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.from_pandas()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.full"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.full()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.get_stats"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.get_stats()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.get_stderr"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.get_stderr()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.get_stdout"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.get_stdout()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.list"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.list()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.rand"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.rand()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.read"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.read()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.scalar"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.scalar()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.seq"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.seq()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.source"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.source()</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="#systemds.context.SystemDSContext.take_stats"><code class="docutils literal notranslate"><span class="pre">SystemDSContext.take_stats()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../operator/algorithms.html">Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../operator/node/matrix.html">Matrix</a></li>
<li class="toctree-l1"><a class="reference internal" href="../operator/node/frame.html">Frame</a></li>
<li class="toctree-l1"><a class="reference internal" href="../operator/node/list.html">List</a></li>
<li class="toctree-l1"><a class="reference internal" href="../operator/node/scalar.html">Scalar</a></li>
<li class="toctree-l1"><a class="reference internal" href="../operator/node/source.html">Source</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Internals API</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../operator/operation_node.html">Operation Node</a></li>
<li class="toctree-l1"><a class="reference internal" href="../script_building/dag.html">Dag</a></li>
<li class="toctree-l1"><a class="reference internal" href="../script_building/script.html">Script</a></li>
<li class="toctree-l1"><a class="reference internal" href="../utils/converters.html">Converters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../utils/helpers.html">Helpers</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../index.html">SystemDS</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">SystemDSContext</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../sources/api/context/systemds_context.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="systemdscontext">
<h1>SystemDSContext<a class="headerlink" href="#systemdscontext" title="Link to this heading"></a></h1>
<p>All operations using SystemDS need a java instance running.
The connection is ensured by an <code class="docutils literal notranslate"><span class="pre">SystemDSContext</span></code> object.
An <code class="docutils literal notranslate"><span class="pre">SystemDSContext</span></code> object can be created using</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">systemds.context</span> <span class="kn">import</span> <span class="n">SystemDSContext</span>
<span class="n">sds</span> <span class="o">=</span> <span class="n">SystemDSContext</span><span class="p">()</span>
</pre></div>
</div>
<p>When the calculations are finished the context has to be closed again</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">sds</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>Since it is annoying that it is always necessary to close the context, <code class="docutils literal notranslate"><span class="pre">SystemDSContext</span></code>
implements the python context management protocol, which supports the following syntax</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">SystemDSContext</span><span class="p">()</span> <span class="k">as</span> <span class="n">sds</span><span class="p">:</span>
  <span class="c1"># do something with sds which is an SystemDSContext</span>
  <span class="k">pass</span>
</pre></div>
</div>
<p>This will automatically close the <code class="docutils literal notranslate"><span class="pre">SystemDSContext</span></code> once the with-block is left.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Creating a context is an expensive procedure, because a sub-process starting a JVM might have to start, therefore
try to do this only once for your program, or always leave at least one context open.</p>
</div>
<dl class="py class">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">systemds.context.</span></span><span class="sig-name descname"><span class="pre">SystemDSContext</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">capture_statistics</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">capture_stdout</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logging_level</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">20</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">py4j_logging_level</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">50</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext" title="Link to this definition"></a></dt>
<dd><p>A context with a connection to a java instance with which SystemDS operations are executed.
The java process is started and is running using a random tcp port for instruction parsing.</p>
<p>This class is used as the starting point for all SystemDS execution. It gives the ability to create
all the different objects and adding them to the execution.</p>
<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.__init__">
<span class="sig-name descname"><span class="pre">__init__</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">-1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">capture_statistics</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">capture_stdout</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">logging_level</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">20</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">py4j_logging_level</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">50</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.__init__" title="Link to this definition"></a></dt>
<dd><p>Starts a new instance of SystemDSContext, in which the connection to a JVM systemds instance is handled
Any new instance of this SystemDS Context, would start a separate new JVM.</p>
<p>Standard out and standard error form the JVM is also handled in this class, filling up Queues,
that can be read from to get the printed statements from the JVM.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>port</strong> – default -1, giving a random port for communication with JVM</p></li>
<li><p><strong>capture_statistics</strong> – If the statistics of the execution in SystemDS should be captured</p></li>
<li><p><strong>capture_stdout</strong> – If the standard out should be captured in Java SystemDS and maintained in ques</p></li>
<li><p><strong>logging_level</strong> – Specify the logging level used for informative messages, default 20 indicating INFO.
The logging levels are as follows: 10 DEBUG, 20 INFO, 30 WARNING, 40 ERROR, 50 CRITICAL.</p></li>
<li><p><strong>py4j_logging_level</strong> – The logging level for Py4j to use, since all communication to the JVM is done through this,
it can be verbose if not set high.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.array">
<span class="sig-name descname"><span class="pre">array</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/list.html#systemds.operator.List" title="systemds.operator.nodes.list.List"><span class="pre">List</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.array" title="Link to this definition"></a></dt>
<dd><p>Create a List object containing the given nodes.</p>
<p>Note that only a sequence is allowed, or a dictionary, not both at the same time.
:param args: A Sequence that will be inserted to a list
:param kwargs: A Dictionary that will return a dictionary, (internally handled as a list)
:return: A List</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.capture_stats">
<span class="sig-name descname"><span class="pre">capture_stats</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">enable</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.capture_stats" title="Link to this definition"></a></dt>
<dd><p>Enable (or disable) capturing of execution statistics.
:param enable: if <cite>True</cite> enable capturing, else disable it</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.capture_stats_context">
<span class="sig-name descname"><span class="pre">capture_stats_context</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.capture_stats_context" title="Link to this definition"></a></dt>
<dd><p>Context for capturing statistics. Should be used in a <cite>with</cite> statement.
Afterwards capturing will be reset to the state it was before.</p>
<p>Example:</p>
<p># <code class="docutils literal notranslate"><span class="pre">`Python</span>
<span class="pre">#</span> <span class="pre">with</span> <span class="pre">sds.capture_stats_context():</span>
<span class="pre">#</span>&#160;&#160;&#160;&#160; <span class="pre">a</span> <span class="pre">=</span> <span class="pre">some_computation.compute()</span>
<span class="pre">#</span>&#160;&#160;&#160;&#160; <span class="pre">b</span> <span class="pre">=</span> <span class="pre">another_computation.compute()</span>
<span class="pre">#</span> <span class="pre">print(sds.take_stats())</span>
<span class="pre">#</span> <span class="pre">`</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>a context object to be used in a <cite>with</cite> statement</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.clear_stats">
<span class="sig-name descname"><span class="pre">clear_stats</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.clear_stats" title="Link to this definition"></a></dt>
<dd><p>Clears the captured statistics.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.close">
<span class="sig-name descname"><span class="pre">close</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.close" title="Link to this definition"></a></dt>
<dd><p>Close the connection to the java process and do necessary cleanup.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.combine">
<span class="sig-name descname"><span class="pre">combine</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Combine</span></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.combine" title="Link to this definition"></a></dt>
<dd><p>combine nodes to call compute on multiple operations.</p>
<p>This is usefull for the case of having multiple writes in one script and wanting 
to execute all in one execution reusing intermediates.</p>
<p>Note this combine does not allow to return anything to the user, so if used,
please only use nodes that end with either writing or printing elements.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>args</strong> – A sequence that will be executed with call to compute()</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.dict">
<span class="sig-name descname"><span class="pre">dict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/list.html#systemds.operator.List" title="systemds.operator.nodes.list.List"><span class="pre">List</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.dict" title="Link to this definition"></a></dt>
<dd><p>Create a List object containing the given nodes.</p>
<p>Note that only a sequence is allowed, or a dictionary, not both at the same time.
:param args: A Sequence that will be inserted to a list
:param kwargs: A Dictionary that will return a dictionary, (internally handled as a list)
:return: A List</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.exception_and_close">
<span class="sig-name descname"><span class="pre">exception_and_close</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">exception</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">trace_back_limit</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.exception_and_close" title="Link to this definition"></a></dt>
<dd><p>Method for printing exception, printing stdout and error, while also closing the context correctly.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>e</strong> – the exception thrown</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.federated">
<span class="sig-name descname"><span class="pre">federated</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">addresses</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Iterable</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ranges</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Iterable</span><span class="p"><span class="pre">[</span></span><span class="pre">Tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">Iterable</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Iterable</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/matrix.html#systemds.operator.Matrix" title="systemds.operator.nodes.matrix.Matrix"><span class="pre">Matrix</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.federated" title="Link to this definition"></a></dt>
<dd><p>Create federated matrix object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sds_context</strong> – the SystemDS context</p></li>
<li><p><strong>addresses</strong> – addresses of the federated workers</p></li>
<li><p><strong>ranges</strong> – for each federated worker a pair of begin and end index of their held matrix</p></li>
<li><p><strong>args</strong> – unnamed params</p></li>
<li><p><strong>kwargs</strong> – named params</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>The Matrix containing the Federated data.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.from_numpy">
<span class="sig-name descname"><span class="pre">from_numpy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mat</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">array</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/matrix.html#systemds.operator.Matrix" title="systemds.operator.nodes.matrix.Matrix"><span class="pre">Matrix</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.from_numpy" title="Link to this definition"></a></dt>
<dd><p>Generate DAGNode representing matrix with data given by a numpy array, which will be sent to SystemDS
on need.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mat</strong> – the numpy array</p></li>
<li><p><strong>args</strong> – unnamed parameters</p></li>
<li><p><strong>kwargs</strong> – named parameters</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>A Matrix</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.from_pandas">
<span class="sig-name descname"><span class="pre">from_pandas</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">df</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">DataFrame</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/frame.html#systemds.operator.Frame" title="systemds.operator.nodes.frame.Frame"><span class="pre">Frame</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.from_pandas" title="Link to this definition"></a></dt>
<dd><p>Generate DAGNode representing frame with data given by a pandas dataframe, which will be sent to SystemDS
on need.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>df</strong> – the pandas dataframe</p></li>
<li><p><strong>args</strong> – unnamed parameters</p></li>
<li><p><strong>kwargs</strong> – named parameters</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>A Frame</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.full">
<span class="sig-name descname"><span class="pre">full</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/matrix.html#systemds.operator.Matrix" title="systemds.operator.nodes.matrix.Matrix"><span class="pre">Matrix</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.full" title="Link to this definition"></a></dt>
<dd><p>Generates a matrix completely filled with a value</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sds_context</strong> – SystemDS context</p></li>
<li><p><strong>shape</strong> – shape (rows and cols) of the matrix TODO tensor</p></li>
<li><p><strong>value</strong> – the value to fill all cells with</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>the OperationNode representing this operation</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.get_stats">
<span class="sig-name descname"><span class="pre">get_stats</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.get_stats" title="Link to this definition"></a></dt>
<dd><p>Get the captured statistics. Will not clear the captured statistics.</p>
<p>See <cite>take_stats()</cite> for an option that also clears the captured statistics.
:return: The captured statistics</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.get_stderr">
<span class="sig-name descname"><span class="pre">get_stderr</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lines</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.get_stderr" title="Link to this definition"></a></dt>
<dd><p>Getter for the stderr of the java subprocess
The output is taken from the stderr queue and returned in a new list.
:param lines: The number of lines to try to read from the stderr queue.
default -1 prints all current lines in the queue.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.get_stdout">
<span class="sig-name descname"><span class="pre">get_stdout</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lines</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">-1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.get_stdout" title="Link to this definition"></a></dt>
<dd><p>Getter for the stdout of the java subprocess
The output is taken from the stdout queue and returned in a new list.
:param lines: The number of lines to try to read from the stdout queue.
default -1 prints all current lines in the queue.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.list">
<span class="sig-name descname"><span class="pre">list</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/list.html#systemds.operator.List" title="systemds.operator.nodes.list.List"><span class="pre">List</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.list" title="Link to this definition"></a></dt>
<dd><p>Create a List object containing the given nodes.</p>
<p>Note that only a sequence is allowed, or a dictionary, not both at the same time.
:param args: A Sequence that will be inserted to a list
:param kwargs: A Dictionary that will return a dictionary, (internally handled as a list)
:return: A List</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.rand">
<span class="sig-name descname"><span class="pre">rand</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rows</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">cols</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">min</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pdf</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'uniform'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sparsity</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">seed</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">lamb</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/matrix.html#systemds.operator.Matrix" title="systemds.operator.nodes.matrix.Matrix"><span class="pre">Matrix</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.rand" title="Link to this definition"></a></dt>
<dd><p>Generates a matrix filled with random values</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sds_context</strong> – SystemDS context</p></li>
<li><p><strong>rows</strong> – number of rows</p></li>
<li><p><strong>cols</strong> – number of cols</p></li>
<li><p><strong>min</strong> – min value for cells</p></li>
<li><p><strong>max</strong> – max value for cells</p></li>
<li><p><strong>pdf</strong> – probability distribution function: “uniform”/”normal”/”poison” distribution</p></li>
<li><p><strong>sparsity</strong> – fraction of non-zero cells</p></li>
<li><p><strong>seed</strong> – random seed</p></li>
<li><p><strong>lamb</strong> – lambda value for “poison” distribution</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p></p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.read">
<span class="sig-name descname"><span class="pre">read</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">PathLike</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/operation_node.html#systemds.operator.OperationNode" title="systemds.operator.operation_node.OperationNode"><span class="pre">OperationNode</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.read" title="Link to this definition"></a></dt>
<dd><p>Read an file from disk. Supported types include:
CSV, Matrix Market(coordinate), Text(i,j,v), SystemDS Binary, etc.
See: <a class="reference external" href="http://apache.github.io/systemds/site/dml-language-reference#readwrite-built-in-functions">http://apache.github.io/systemds/site/dml-language-reference#readwrite-built-in-functions</a> for more details
:return: an Operation Node, containing the read data the operationNode read can be of types, Matrix, Frame or Scalar.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.scalar">
<span class="sig-name descname"><span class="pre">scalar</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">v</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="../script_building/dag.html#systemds.script_building.dag.DAGNode" title="systemds.script_building.dag.DAGNode"><span class="pre">DAGNode</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">bool</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/scalar.html#systemds.operator.Scalar" title="systemds.operator.nodes.scalar.Scalar"><span class="pre">Scalar</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.scalar" title="Link to this definition"></a></dt>
<dd><p>Construct an scalar value, this can contain str, float, double, integers and booleans.
:return: A scalar containing the given value.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.seq">
<span class="sig-name descname"><span class="pre">seq</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">start</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stop</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">step</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/matrix.html#systemds.operator.Matrix" title="systemds.operator.nodes.matrix.Matrix"><span class="pre">Matrix</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.seq" title="Link to this definition"></a></dt>
<dd><p>Create a single column vector with values from <cite>start</cite> to <cite>stop</cite> and an increment of <cite>step</cite>.
If no stop is defined and only one parameter is given, then start will be 0 and the parameter will be interpreted as
stop.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sds_context</strong> – SystemDS context</p></li>
<li><p><strong>start</strong> – the starting value</p></li>
<li><p><strong>stop</strong> – the maximum value</p></li>
<li><p><strong>step</strong> – the step size</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>the OperationNode representing this operation</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.source">
<span class="sig-name descname"><span class="pre">source</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="../operator/node/source.html#systemds.operator.Source" title="systemds.operator.nodes.source.Source"><span class="pre">Source</span></a></span></span><a class="headerlink" href="#systemds.context.SystemDSContext.source" title="Link to this definition"></a></dt>
<dd><p>Import methods from a given dml file.</p>
<p>The importing is done through the DML command source, and adds all defined methods from
the script to the Source object returned in python. This gives the flexibility to call the methods 
directly on the object returned.</p>
<p>In systemds a method called func_01 can then be imported using</p>
<p><code class="docutils literal notranslate"><span class="pre">`python</span>
<span class="pre">res</span> <span class="pre">=</span> <span class="pre">self.sds.source(&quot;PATH_TO_FILE&quot;,</span> <span class="pre">&quot;UNIQUE_NAME&quot;).func_01().compute(verbose</span> <span class="pre">=</span> <span class="pre">True)</span>
<span class="pre">`</span></code></p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> – The absolute or relative path to the file to import</p></li>
<li><p><strong>name</strong> – The name to give the imported file in the script, this name must be unique</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="systemds.context.SystemDSContext.take_stats">
<span class="sig-name descname"><span class="pre">take_stats</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#systemds.context.SystemDSContext.take_stats" title="Link to this definition"></a></dt>
<dd><p>Get the captured statistics and clear the captured statistics.</p>
<p>See <cite>get_stats()</cite> for an option that does not clear the captured statistics.
:return: The captured statistics</p>
</dd></dl>

</dd></dl>

</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../../guide/python_end_to_end_tut.html" class="btn btn-neutral float-left" title="Python end-to-end tutorial" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../operator/algorithms.html" class="btn btn-neutral float-right" title="Algorithms" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2023, Apache SystemDS.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>